<?php
const RESOURCE_OWNER_ID = 1715157912603612;// UID
const ACCESS_KEY_ID = 'LTAI4Fm72pMfFfEzhw7upcKp';// AccessKeyId
const ACCESS_KEY_SECRET = 'V0JzTjtQYDA7K4heAdYZCIUL3kVcJQ';// AccessKeySecret

function getMqUser()
{
    $t = '0:' . RESOURCE_OWNER_ID . ':' . ACCESS_KEY_ID;
    return base64_encode($t);
}

function getMqPassword()
{
    $ts = (int)(microtime(true) * 1000);
    $value = utf8_encode(ACCESS_KEY_SECRET);
    $key = utf8_encode((string)$ts);
    $sig = strtoupper(hash_hmac('sha1', $value, $key, FALSE));
    return base64_encode(utf8_encode($sig . ':' . $ts));
}

return [
    // 阿里云MQ配置
    'RABBITMQ_HOST' => env('RABBITMQ_HOST', ''),
    'RABBITMQ_PORT' => 5672,
    'RABBITMQ_VHOST' => env('RABBITMQ_VHOST', ''),
    'RABBITMQ_LOGIN' => getMqUser(),
    'RABBITMQ_PASSWORD' => getMqPassword(),

    // 队列路由
    'queueRoute' => [
        'global.finance.recharge' => [ // 资产充值
            'exchangeName' => 'kkaudio_queue',
            'queueName' => 'nation_recharge', //国庆充值
            'routeKey' => [
                'global.finance.recharge',
            ],
        ],

        'global.finance.topup_rebate' => [ // 资产充值
            'exchangeName' => 'kkaudio_queue',
            'queueName' => 'topup_rebate', //国庆充值
            'routeKey' => [
                'global.finance.recharge',
            ],
        ],

        'global.finance.diamond.change' => [ // 资产 钻石变更（增/减）
            'exchangeName' => 'kkaudio_queue',
            'queueName' => 'diamond_change',
            'routeKey' => [
                'global.finance.diamond.change',
            ],
        ],
        'global.finance.kk.change' => [
            'exchangeName' => 'kkaudio_queue',
            'queueName' => 'kk_blance_to_diamond',
            'routeKey' => [
                'global.finance.kk.change',
            ],
        ],
        'global.gift.give' => [ // 赠送礼物
            'exchangeName' => 'kkaudio_queue',
            'queueName' => 'nation_gift_give',
            'routeKey' => [
                'global.gift.give',
            ],
        ],

        'global.activity' => [ // 活动通知
            'exchangeName' => 'kkaudio_queue',
            'queueName' => 'nation_buy_ticket',
            'routeKey' => [
                'global.activity.gift.pack.purchase',// 活动礼包购买
            ],
        ],

        'global.user.register' => [ // 用户注册
            'exchangeName' => 'kkaudio_queue',
            'queueName' => '',
            'routeKey' => [
                'global.user.register',
            ],
        ],

        'global.user.login' => [ // 用户登录
            'exchangeName' => 'kkaudio_queue',
            'queueName' => '',
            'routeKey' => [
                'global.user.login',
            ],
        ],

        'global.user.active' => [ // 用户活跃
            'exchangeName' => 'kkaudio_queue',
            'queueName' => '',
            'routeKey' => [
                'global.user.active',
            ],
        ],
        'global.newYear.gift.give' => [
            'exchangeName' => 'kkaudio_queue',
            'queueName' => 'nation_newYear_gift_give',
            'routeKey' => [
                'global.gift.give',
            ],
        ],
        'global.system.notice' => [ //常用业务通知
            'exchangeName' => 'kkaudio_queue',
            'queueName' => 'nation_system_notice',
            'routeKey' => [
                'global.system.notice',
            ],
        ],
        'global.boat.gift.give' => [
            'exchangeName' => 'kkaudio_queue',
            'queueName' => 'nation_boat_gift_give',
            'routeKey' => [
                'global.gift.give',
            ],
        ],
        'global.playDish.pay' => [
            'exchangeName' => 'kkaudio_queue',
            'queueName' => 'nation_play_dish_pay',
            'routeKey' => [
                'global.playDish.pay',
            ],
        ],
        'global.playDish.open.room' => [
            'exchangeName' => 'kkaudio_queue',
            'queueName' => 'nation_dish_open_room',
            'routeKey' => [
                'global.playDish.open.room',
            ],
        ],
        'global.soundByte.gift.give' => [
            'exchangeName' => 'kkaudio_queue',
            'queueName' => 'global.soundByte.gift.give',
            'routeKey' => [
                'global.appoint.gift.give',
            ],
        ],
    ]
];
